package com.fjnldx.mes.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class myMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login3").setViewName("login3");
        registry.addViewController("/select").setViewName("teacher2");
    }
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //和页面有关的静态目录都放在项目的static目录下
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
        //其中OTA表示访问的前缀。"file:D:/OTA/"是文件真实的存储路径
        String userDir = System.getProperty("user.dir");
        String filePath = userDir + "/images/";
        registry.addResourceHandler("/OTA/**").addResourceLocations("file:"+filePath);
    }
}
